package com.example.login;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.R;
import com.example.mail.MailTypeActivity;
import core.model.Game;


public class LoginActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.loginlayout);

        final TextView party = (TextView) findViewById(R.id.loginParty);
        final TextView race = (TextView) findViewById(R.id.loginRace);
        final TextView password = (TextView) findViewById(R.id.loginPassword);

        Button submit = (Button) findViewById(R.id.loginSubmit);
        submit.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {

                Game game = new Game();
                game.setParty(party.getText().toString());
                game.setRace(race.getText().toString());
                game.setPassword(password.getText().toString());

                View loginView = findViewById(R.id.loginLayout);
                Intent i = new Intent(loginView.getContext(), MailTypeActivity.class);
                i.putExtra("game", game);
                loginView.getContext().startActivity(i);
            }
        });
    }
}
